import 'package:flutter/cupertino.dart';
import 'package:pull_to_refresh_plus/pull_to_refresh_plus.dart';
import '../../config/assets.dart';

class RefreshFooterWidget {
  //通用，--the end--
  static Widget commonFooter() {
    return CustomFooter(
      builder: (BuildContext context, LoadStatus? mode) {
        Widget body;
        if (mode == LoadStatus.idle) {
          body = const Text("上拉加载更多");
        } else if (mode == LoadStatus.loading) {
          body = const CupertinoActivityIndicator();
        } else if (mode == LoadStatus.failed) {
          body = const Text("加载失败");
        } else if (mode == LoadStatus.canLoading) {
          body = const Text("上拉加载更多");
        } else {
          //没有更多
          return Container(
            height: 140 / 2,
            alignment: Alignment.center,
            child: FWAssets.noMore,
          );
        }
        return SizedBox(
          height: 50,
          child: Center(child: body),
        );
      },
    );
  }
}
